from django.conf.urls import url
from django.contrib import admin
from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import obtain_jwt_token
from . import views, serializer

urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    # 注册用户统计
    url(r'^statistical/total_count/$', views.UserTotalCountView.as_view()),
    # 日增用户统计
    url(r'^statistical/day_increment/$', views.UserDayCountView.as_view()),
    # 日活用户统计
    url(r'^statistical/day_active/$', views.UserActiveCountView.as_view()),
    # 日下单用户统计
    url(r'^statistical/day_orders/$', views.UserOrderCountView.as_view()),
    # 月增用户统计
    url(r'^statistical/month_increment/$', views.UserMonthCountView.as_view()),
    # 商品访问量统计
    url(r'^statistical/goods_day_views/$', views.GoodsDayView.as_view()),
    # 获取用户信息
    url(r'^users/$', views.UserView.as_view()),
    # 保存用户信息
    url(r'^goods/simple/$', views.SpecsView.as_view({'get': 'simple'})),
    # 获取SKU商品信息
    url(r'^skus/simple/$', views.ImageView.as_view({'get': 'simple'})),
    # 商品SKU
    url(r'^goods/(?P<pk>\d+)/specs/$', views.SKUView.as_view({'get': 'specs'})),
    # 权限
    url(r'^permission/content_types/$', views.PermissionView.as_view({'get': 'content_types'})),
    # 获取权限
    url(r'^permission/simple/$', views.GroupView.as_view({'get': 'simple'})),
    # 获取管理员
    url(r'^permission/groups/simple/$', views.AdminView.as_view({'get': 'simple'})),
    # 商品SPU
    url(r'^goods/brands/simple/$', views.SPUView.as_view({'get': 'brand'})),
    # 商品三级分类
    url(r'^goods/channel/categories/$', views.SPUView.as_view({'get': 'simple'})),
    url(r'^goods/channel/categories/(?P<pk>\d+)/$', views.SPUView.as_view({'get': 'category'})),
    # 规格选项
    url(r'^goods/specs/simple/$', views.SPUSpecsView.as_view({'get': 'simple'})),
    # 品牌管理
    # url(r'^goods/brands/$', views.BrandView.as_view({'get': 'simple'})),
    url(r'^goods/channel_types/$', views.GoodsChannelView.as_view({'get': 'simple'})),
    url(r'^goods/categories/$', views.GoodsChannelView.as_view({'get': 'type'})),
    # 频道管理
    # url(r'^goods/channels/(?P<pk>\d+)/$',views.GoodsChannelView.as_view({'get': 'simple'}))
]
# 表数据获取
router = DefaultRouter()
router.register('goods/specs', views.SpecsView, base_name='specs')
urlpatterns += router.urls
# 频道管理
router = DefaultRouter()
router.register('goods/channels', views.GoodsChannelView, base_name='channe')
urlpatterns += router.urls
# 图片表的获取
router = DefaultRouter()
router.register('skus/images', views.ImageView, base_name='images')
urlpatterns += router.urls
# 商品SKU
router = DefaultRouter()
router.register('skus', views.SKUView, base_name='SKU')
urlpatterns += router.urls
# 订单信息
router = DefaultRouter()
router.register('orders', views.OrderView, base_name='order')
urlpatterns += router.urls
# 权限信息
router = DefaultRouter()
router.register('permission/perms', views.PermissionView, base_name='permission')
urlpatterns += router.urls
# 分组信息
router = DefaultRouter()
router.register('permission/groups', views.GroupView, base_name='groups')
urlpatterns += router.urls
# 管理员分组
router = DefaultRouter()
router.register('permission/admins', views.AdminView, base_name='groups')
urlpatterns += router.urls
# 品牌管理
router = DefaultRouter()
router.register('goods/brands', views.BrandView, base_name='brand')
urlpatterns += router.urls
# SPU表
router = DefaultRouter()
router.register('goods', views.SPUView, base_name='GOODS')
urlpatterns += router.urls
# 规格选项
router = DefaultRouter()
router.register('specs/options', views.SPUSpecsView, base_name='options')
urlpatterns += router.urls
